#include "msp430f5309.h"
#include "Driver/mystring.h"
#include "string.h"
#include "Driver/handl.h"

unsigned char sum_buffer[300] = {0x00};

unsigned char buffer1[64] = {
	0x31, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x71, 
	0x8F, 0x01, 0x41, 0x89, 0x23, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x07, 0xFF, 0xF8, 0x1F, 0xFF,
	0x9F, 0xFF, 0xE0, 0x7F, 0xFF, 0x9F, 0x07, 0xFF,
	0xa4
};

unsigned char buffer2[64] = {
	0x33, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x72, 
	0x8D, 0x03, 0x55, 0x53, 0x41, 0x89, 0x23, 0xFC,
	0x3F, 0xFF, 0x9F, 0xFF, 0xF1, 0xFF, 0xFF, 0xBF,
	0x07, 0xFF, 0xFC, 0x7F, 0xFF, 0x9F, 0xFF, 0xF3,
	0xFF, 0xFF, 0x3E, 0x0F, 0xC0, 0x7E, 0xFF, 0xFF,
	0x9F, 0x01, 0xFB, 0xFF, 0xFF, 0x3E, 0x0F, 0x80,
	0x3E, 0xF8, 0x07
};

unsigned char buffer3[64] = {
	0x36, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x73, 
	0x8E, 0x06, 0x42, 0x6F, 0x74, 0x74, 0x6C, 0x65, 
	0x89, 0x23, 0x00, 0x3E, 0x00, 0xFB, 0xE0, 0x00,
	0x3E, 0x0F, 0x80, 0x7E, 0xF8, 0x00, 0x3E, 0x00,
	0xFF, 0xE0, 0x00, 0x3E, 0x0F, 0x80, 0x7C, 0xF8,
	0x00, 0x3E, 0x01, 0xF7, 0xE0, 0x00, 0x7E, 0x0F,
	0xFF, 0xFD, 0xFF, 0xFF, 0x3E, 0xf6
};

unsigned char buffer4[64] = {
	0x31, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x74, 
	0x9A, 0x01, 0x31, 0x89, 0x23, 0xFF, 0xF7, 0xFF,
	0xF8, 0x7C, 0x1F, 0xFF, 0xF9, 0xFF, 0xFE, 0x7F,
	0xFF, 0xE3, 0xFF, 0xFE, 0x7C, 0x1F, 0xFF, 0xF9,
	0xFF, 0xFE, 0x7F, 0xFF, 0xE3, 0xFF, 0xFE, 0x7C,
	0x1F, 0xFF, 0xF1, 0xFF, 0xFE, 0x7F, 0xFF, 0xC1,
	0x21
};

unsigned char buffer5[64] = {
	0x34, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x75, 
	0x8A, 0x04, 0x00, 0x0A, 0x03, 0x03, 0x89, 0x23, 
	0xFF, 0xFE, 0x7C, 0x1F, 0xFF, 0x81, 0xF0, 0x00,
	0x7F, 0xFE, 0x00, 0x00, 0x7E, 0xF8, 0x1F, 0x00,
	0x01, 0xF0, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x3E,
	0xF8, 0x3E, 0x00, 0x03, 0xF0, 0x00, 0xFC, 0x00,
	0x00, 0x00, 0x3E, 0xde
};

unsigned char buffer6[64] = {
	0x3d, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x76, 
	0x8B, 0x0D, 0x06, 0x09, 0x00, 0x02, 0x08, 0x02, 
	0x07, 0x02, 0x00, 0x03, 0x00, 0x01, 0x02, 0x89, 
	0x23, 0xF8, 0x3E, 0x00, 0x03, 0xFF, 0xFE, 0xF8,
	0x00, 0x0F, 0xFF, 0xFE, 0xF8, 0x3E, 0x00, 0x03,
	0xFF, 0xFE, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0xF8,
	0x3E, 0x00, 0x01, 0xFF, 0xFC, 0xF8, 0x00, 0x0F,
	0xFF, 0xF9, 0xF0, 0x3E, 0x24
};

unsigned char buffer7[64] = {
	0x24, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x77, 
    0x88, 0x0b, 0x50, 0x65, 0x70, 0x73, 0x69, 0x20, 
    0x53, 0x6f, 0x64, 0x61, 0x73, 0x89, 0x0a, 0x00, 
    0x00, 0xFF, 0xFC, 0xF8, 0x00, 0x1F, 0xFF, 0xF1, 
    0xF0, 0x25
};

/*
unsigned char buffer1[64] = {
	0x10, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x77,
	0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0xaa,
};

unsigned char buffer2[64] = {
	0x10, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x77,
	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0xaa,
};

unsigned char buffer3[64] = {
	0x10, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x77,
	0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0xaa,
};

unsigned char buffer4[64] = {
	0x10, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x77,
	0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0xaa,
};

unsigned char buffer5[64] = {
	0x10, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x77,
	0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0xaa,
};

unsigned char buffer6[64] = {
	0x10, 0x64, 0x00, 0x00, 0x01, 0x33, 0x33, 0x77,
	0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0xaa,
};
*/

void main()
{
    WDTCTL = WDTPW + WDTHOLD;
     
    while (1)
    {

        memset(sum_buffer, 0x00, sizeof(sum_buffer)); 
        
        memcombination(sum_buffer, buffer1);
    //    combin(buffer2);
        memcombination(sum_buffer, buffer2);
    //    combin(buffer3);
        memcombination(sum_buffer, buffer3);
    //    combin(buffer4);
        memcombination(sum_buffer, buffer4);
    //    combin(buffer5);
        memcombination(sum_buffer, buffer5);
    //    combin(buffer6);
        memcombination(sum_buffer, buffer6);
    //    combin(buffer7);
        memcombination(sum_buffer, buffer7);
    
        handl_EN(sum_buffer);
    }
}